You can configure a flex field to use extra XML definitions such as widgets, table attributes, and measured unit field definitions. For this purpose, you use the Extra XML Definition field in the Edit Metafield form (on page 1). For more detailed information on how to use this form, see Configuring a flex field in N4 (on page 1).
To figure out the XML definition to use, find a similar field and look up the XML definition in the Metafield Diagnostics for UI Tier view by right-clicking the field and selecting Show Diagnostics.
N4 does not validate XML code.
Table attributes
The following table attributes control the display of a field value in the column of a list view:
hAlignment: Controls a field's justification. The default justification depends on the type, as follows:
Right for numbers
Center for enumerated types
Left for all other types
maxFractionalDigits: Applies to decimal fields of type Double. By default, this is set to 3.
The following code segment shows these attributes in a .dtd fragment:
<!ELEMENT table (attributes?)>
<!ATTLIST table hAlignment (left|center|right) #IMPLIED>
<!ATTLIST table maxFractionalDigits CDATA #IMPLIED>
Measured unit field definitions
You can configure a flex field with a data type of double to be a measured unit of one of the following types:
Length
Temperature
Mass
The following attributes govern the handling of measured fields:
dataUnitField: Represents the unit stored in the database. You set this attribute once and do not change it when the table includes data. Changing this attribute does not convert existing data in the database.
userUnit: Represents the default unit displayed in the user interface, that is in table list views and forms.
The following code segment shows these attributes in a .dtd fragment:
<!ELEMENT measure (length | volume | mass | temperature ) >
<!ELEMENT length EMPTY>
<!ATTLIST length dataUnit (mm|cm|m|in|ft|yd|dynamic) #REQUIRED >
<!ATTLIST length userUnit (mm|cm|m|in|ft|yd|dynamic) #REQUIRED >
<!ELEMENT temperature EMPTY>
<!ATTLIST temperature dataUnit (F|C|dynamic) #REQUIRED >
<!ATTLIST temperature userUnit (F|C|dynamic) #REQUIRED >
<!ELEMENT mass EMPTY> <!-- fully supported-->
<!ATTLIST mass dataUnit (g|kg|lb|quintals|long-ton|short-ton|tonne|dynamic) #REQUIRED >
<!ATTLIST mass userUnit (g|kg|lb|quintals|long-ton|short-ton|tonne|dynamic) #REQUIRED >
In the following example, the XML definition allows this dynamic field to be used as a temperature widget. This is the code you would enter in the Extra XML Definition field in the Edit Metafield form.
<metafield id="eqtypCustomDFFDouble2>
<measure>
<temperature dataUnit="C" userUnit="F" />
</measure>
<table maxFractionalDigits="1" />
</metafield>
The following figure illustrates how the field behaves in the user interface:
In the table list view, N4 displays the column in the user unit of Fahrenheit.
In the form, the field accepts Fahrenheit or Celsius, but if you do not specify a unit, N4 assumes the user unit of Fahrenheit.
It is more likely, however, that you store and display in the same measured unit.